﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Tst.Models
{
    public class ModuloRepository
    {

        private TstEntities context;


        public ModuloRepository()
        {
            this.context = new TstEntities();
        }

        ~ModuloRepository()
        {
            this.context.Dispose();
        }

        public void Save()
        {
            this.context.SaveChanges();
        }

        public IList<Modulo> GetAll()
        {
            return this.context.Modulo.ToList();
        }

        public Modulo GetById(int cd_modulo)
        {
            return this.context.Modulo.FirstOrDefault(m => m.cd_modulo == cd_modulo);
        }





    }
}
